<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns an array representation of the document</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="solrdocument.sort.html">SolrDocument::sort</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="solrdocument.unserialize.html">SolrDocument::unserialize</a></div>
 <div class="up"><a href="class.solrdocument.html">SolrDocument</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="solrdocument.toarray" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SolrDocument::toArray</h1>
     <p class="verinfo">(PECL solr &gt;= 0.9.2)</p><p class="refpurpose"><span class="refname">SolrDocument::toArray</span> &mdash; <span class="dc-title">Returns an array representation of the document</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-solrdocument.toarray-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><strong>SolrDocument::toArray</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Returns an array representation of the document.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-solrdocument.toarray-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-solrdocument.toarray-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an array representation of the document.
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-solrdocument.toarray-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4620">
    <p><strong>Example #1 <span class="methodname"><strong>SolrDocument::toArray()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$doc&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">SolrDocument</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addField</span><span style="color: #007700">(</span><span style="color: #DD0000">'id'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1123</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">features&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"PHP&nbsp;Client&nbsp;Side"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">features&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Fast&nbsp;development&nbsp;cycles"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$doc</span><span style="color: #007700">[</span><span style="color: #DD0000">'cat'</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">'Software'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$doc</span><span style="color: #007700">[</span><span style="color: #DD0000">'cat'</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #DD0000">'Custom&nbsp;Search'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cat&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Information&nbsp;Technology'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">toArray</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [document_boost] =&gt; 0
    [field_count] =&gt; 3
    [fields] =&gt; Array
        (
            [0] =&gt; SolrDocumentField Object
                (
                    [name] =&gt; id
                    [boost] =&gt; 0
                    [values] =&gt; Array
                        (
                            [0] =&gt; 1123
                        )

                )

            [1] =&gt; SolrDocumentField Object
                (
                    [name] =&gt; features
                    [boost] =&gt; 0
                    [values] =&gt; Array
                        (
                            [0] =&gt; PHP Client Side
                            [1] =&gt; Fast development cycles
                        )

                )

            [2] =&gt; SolrDocumentField Object
                (
                    [name] =&gt; cat
                    [boost] =&gt; 0
                    [values] =&gt; Array
                        (
                            [0] =&gt; Software
                            [1] =&gt; Custom Search
                            [2] =&gt; Information Technology
                        )

                )

        )

)
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="solrdocument.sort.html">SolrDocument::sort</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="solrdocument.unserialize.html">SolrDocument::unserialize</a></div>
 <div class="up"><a href="class.solrdocument.html">SolrDocument</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
